<?php

declare(strict_types=1);

namespace App\Job;

use Hyperf\AsyncQueue\Job;
use Hyperf\Di\Annotation\Inject;

class RequestLogJob extends Job
{
    public $params;


    public function __construct($params)
    {
        $this->params = $params;
    }

    public function handle()
    {
        try{
            $insert = [
                'visit_id' => $this->params['visit_id'] ?? '',
                'path' => $this->params['path'] ?? '',
                'parameter' => $this->params['parameter'] ?? '',
                'result' => $this->params['result'] ?? '',
                'add_time' => time(),
            ];
            \App\Model\RequestLog::query()->insertGetId($insert);
        }catch(\Throwable $t){
            var_dump($t->getMessage());
        }
    }
}
